from tests.base_test import base_test_case

logger = base_test_case.get_logger(__name__)
TEST_DATA_DIR = base_test_case.test_data_dir
OUTPUT_DATA_DIR = base_test_case.output_data_dir
CONF_DIR = base_test_case.conf_dir
CONF_PIPELINE_DIR = base_test_case.conf_pipeline_dir

if __name__ == '__main__':
    input_file = str(TEST_DATA_DIR / "table.jpg")
    config_file = str(CONF_PIPELINE_DIR / "PP-StructureV3.yaml")

    # from paddlex.utils.config import parse_config
    # yaml_config = parse_config(config_file)

    from paddlex.inference import load_pipeline_config
    yaml_config = load_pipeline_config(config_file)
    print(yaml_config)

    from paddlex.inference import create_pipeline
    pipeline = create_pipeline(config=yaml_config, initial_predictor=False)

    results = pipeline.predict(input_file)
    for res in results:
        res.print()
    pass
